package com.example.demo.module.sofarpc.client;

import com.alipay.sofa.rpc.config.ConsumerConfig;
import com.example.demo.module.sofarpc.service.HelloService;

/**
 * @author lufei
 * @version 1.0
 * @created 18-5-14
 */
public class SofcRpcClient {
    public static void main(String[] args) {
        ConsumerConfig<HelloService> consumerConfig = new ConsumerConfig<HelloService>()
                .setInterfaceId(HelloService.class.getName())
                .setProtocol("bolt")
                .setDirectUrl("http://127.0.0.1:12200");

        HelloService helloService = consumerConfig.refer();
        while (true) {
            System.out.println(helloService.sayHello("world"));
            try {
                Thread.sleep(3000);
            } catch (InterruptedException e) {
//
                e.printStackTrace();
            }
        }
    }
}
